inscatolati - Get out of the box! :)
-> root
-> programming
-> ::programming::bash
Everything related to writing bash scripts.
grep matching too much, or behaving unpredictably (well, in a strange way)
[34]
At least twice in my life I've been surprised by grep either not matching what it was supposed to, or matching too much.
Both times it turned out to be a problem with the locale configured on the system. Yes, locale settings influence things like what are to be considered whitespaces, letters, and so on. grep and many other matching libraries keep that in consideration, and change behavior accordingly.
While this is kind of expected, if the locale configuration is screwed for the language being used, grep (and many other tools...) may really get confused.
Check the locale configurations, and try with things like:
|
This note is available in the following categories:
Debugging unix domain sockets
[38]
Ever found yourself trying to debug an application
that relies on unix sockets as the way of communication?
Well, a tool that often comes handy is "socat".
Socat is a bit like netcat, but supports all sorts of
connection styles, socket types, and so on.
Try things like:
socat is great, it has libreadline support (history
and so on) and allows to set / change almost every
parameter of any socket types. Have a peek in
its man page.
It is also useful from bash scripts, if you want
to do any kind of connection handling. But... you'd
probably better off with a real programming language
if that's what you want to do. Stop abusing your shell.
|
This note is available in the following categories: